
// const QRCode = require('../../utils/weapp-qrcode.js')
// import QRCode from '../../utils/weapp-qrcode.js'
import QRCode from '../../utils/weapp.qrcode'

Page({
  data: {
    codeText: ''
  },
  onLoad() {

    QRCode({
      width: 300,
      height: 300,
      canvasId: 'canvas',
      text: 'https://github.com/yingye',
      image: {
        imageResource: '../../images/liqin.jpg',
        dx: 100,
        dy: 100,
        dWidth: 100,
        dHeight: 100
      },
      callback(res) {
        console.log(res)
      }
    });

  },
  inputChange(e) {
    // console.log(e.detail.value)
    this.setData({
      codeText: e.detail.value
    })
  },
  createQrcode() {
    // console.log(this.data.codeText)
    QRCode({
      width: 300,
      height: 300,
      canvasId: 'canvas',
      text: this.data.codeText,
      image: {
        imageResource: '../../images/liqin.jpg',
        dx: 100,
        dy: 100,
        dWidth: 100,
        dHeight: 100
      },
      callback(res) {
        console.log(res)
      }
    });
  }
})
